Abstract
Compiler correctness is an old problem, but with the emergence of smart contracts on blockchains that problem presents itself in a new light. Smart contracts are self-contained pieces of software that control (valuable) assets in an adversarial environment; once committed to the blockchain, these smart contracts cannot be modified. Smart contracts are typically developed in a high-level contract language and compiled to low-level virtual machine code before being committed to the blockchain. For a smart contract user to trust a given piece of low-level code on the blockchain, they must convince themselves that (a) they are in possession of the matching source code and (b) that the compiler has correctly translated the source code to the given low-level code.
Classic approaches to compiler correctness tackle the second point. We argue that translation certification also squarely addresses the first. We describe the proof architecture of a novel translation certification framework, implemented in Coq, for a functional smart contract language. We demonstrate that we can model the compilation pipeline as a sequence of translation relations that facilitate a modular verification methodology and are robust in the face of an evolving compiler implementation.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
Notes
- 1.
- 2.
http://cardano.org is, at the time of writing, the 5th largest public blockchain by market capitalisation.
- 3.
- 4.
References
Abadi, M., Cardelli, L., Plotkin, G.: Types for the Scott numerals (1993)
Ahmed, A.: Step-indexed syntactic logical relations for recursive and quantified types. In: Sestoft, P. (ed.) ESOP 2006. LNCS, vol. 3924, pp. 69–83. Springer, Heidelberg (2006). https://doi.org/10.1007/11693024_6
Anand, A., et al.: CertiCoq: a verified compiler for Coq. In: The Third International Workshop on Coq for Programming Languages (CoqPL) (2017)
Annenkov, D., Nielsen, J.B., Spitters, B.: ConCert: a smart contract certification framework in Coq. In: Proceedings of the 9th ACM SIGPLAN International Conference on Certified Programs and Proofs, pp. 215–228 (2020)
Maffei, M., Ryan, M. (eds.): POST 2017. LNCS, vol. 10204. Springer, Heidelberg (2017). https://doi.org/10.1007/978-3-662-54455-6
Barras, B., et al.: The Coq proof assistant reference manual: Version 6.1. Ph.D. thesis, Inria (1997)
Barthe, G., Fournet, C., Grégoire, B., Strub, P.Y., Swamy, N., Zanella-Béguelin, S.: Probabilistic relational verification for cryptographic implementations. ACM SIGPLAN Not. 49(1), 193–205 (2014)
Bernardo, B., Cauderlier, R., Hu, Z., Pesin, B., Tesson, J.: Mi-Cho-Coq, a framework for certifying tezos smart contracts. In: Sekerinski, E., et al. (eds.) FM 2019. LNCS, vol. 12232, pp. 368–379. Springer, Cham (2020). https://doi.org/10.1007/978-3-030-54994-7_28
Bertot, Y., Castéran, P.: Interactive Theorem Proving and Program Development: Coq’Art: The Calculus of Inductive Constructions. Springer, Heidelberg (2013). https://doi.org/10.1007/978-3-662-07964-5
Bhargavan, K., et al.: Formal verification of smart contracts: short paper. In: Proceedings of the 2016 ACM Workshop on Programming Languages and Analysis for Security, pp. 91–96 (2016)
Breitner, J., Spector-Zabusky, A., Li, Y., Rizkallah, C., Wiegley, J., Weirich, S.: Ready, set, verify! applying hs-to-coq to real-world Haskell code (experience report). In: Proceedings of the ACM on Programming Languages 2(ICFP), pp. 1–16 (2018)
Buterin, V.: CRITICAL UPDATE Re: DAO Vulnerability (2016). https://blog.ethereum.org/2016/06/17/critical-update-re-dao-vulnerability/, Accessed 10 Dec 2021
Hutton, G. (ed.): MPC 2019. LNCS, vol. 11825. Springer, Cham (2019). https://doi.org/10.1007/978-3-030-33636-3
Dral, J.: Verified Compiler Optimisations. Master’s thesis, Utrecht University (2022)
GHC Team: GHC 9.0 User Manual. https://downloads.haskell.org/~ghc/9.0.1/docs/html/users_guide/extending_ghc.html
Giegerich, R., Möncke, U.: Invariance of approximative semantics with respect to program transformations. In: GI-11. Jahrestagung, pp. 1–10. Springer, Heidelberg (1981). https://doi.org/10.1007/978-3-662-01089-1_1
Gonthier, G., Le, R.S.: An Ssreflect Tutorial. Ph.D. thesis, INRIA (2009)
IOHK: The Plutus Platform and Marlowe 1.0.0 documentation. https://plutus.readthedocs.io/en/latest/plutus/tutorials/plutus-tx.html
Jones, M.P., Gkoumas, V., Kireev, R., MacKenzie, K., Nester, C., Wadler, P.: Unraveling recursion: compiling an IR with recursion to system F. In: Hutton, G. (ed.) MPC 2019. LNCS, vol. 11825, pp. 414–443. Springer, Cham (2019). https://doi.org/10.1007/978-3-030-33636-3_15
Kumar, R., Myreen, M.O., Norrish, M., Owens, S.: CakeML: a verified implementation of ML. ACM SIGPLAN Not. 49(1), 179–191 (2014)
Leroy, X., Blazy, S., Kästner, D., Schommer, B., Pister, M., Ferdinand, C.: CompCert–a formally verified optimizing compiler. In: ERTS 2016: Embedded Real Time Software and Systems, 8th European Congress (2016)
Li, J.M., Appel, A.W.: Deriving efficient program transformations from rewrite rules. Proc. ACM Program. Lang. 5(ICFP), 1–29 (2021)
Necula, G.C.: Proof-carrying code. In: Proceedings of the 24th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 106–119 (1997)
Necula, G.C., Lee, P.: The design and implementation of a certifying compiler. SIGPLAN Not. 39(4), 612–625 (2004)
O’Connor, L., et al.: Cogent: uniqueness types and certifying compilation. J. Funct. Program. 31, e25 (2021)
Lahiri, S.K., Wang, C. (eds.): CAV 2020. LNCS, vol. 12224. Springer, Cham (2020). https://doi.org/10.1007/978-3-030-53288-8
Pnueli, A., Siegel, M., Singerman, E.: Translation validation. In: Steffen, B. (ed.) TACAS 1998. LNCS, vol. 1384, pp. 151–166. Springer, Heidelberg (1998). https://doi.org/10.1007/BFb0054170
Sozeau, M., et al.: The MetaCoq project. J. Autom. Reas. 64, 947–999 (2020)
Spector-Zabusky, A., Breitner, J., Rizkallah, C., Weirich, S.: Total Haskell is reasonable Coq. In: Proceedings of the 7th ACM SIGPLAN International Conference on Certified Programs and Proofs, pp. 14–27 (2018)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2022 Springer Nature Switzerland AG
About this paper
Cite this paper
Krijnen, J.O.G., Chakravarty, M.M.T., Keller, G., Swierstra, W. (2022). Translation Certification for Smart Contracts. In: Hanus, M., Igarashi, A. (eds) Functional and Logic Programming. FLOPS 2022. Lecture Notes in Computer Science, vol 13215. Springer, Cham. https://doi.org/10.1007/978-3-030-99461-7_6
Download citation
DOI: https://doi.org/10.1007/978-3-030-99461-7_6
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-99460-0
Online ISBN: 978-3-030-99461-7
eBook Packages: Computer ScienceComputer Science (R0)