Repository navigation
Expand file tree
/
Copy pathSpec.lean
More file actions
54 lines (39 loc) · 2.05 KB
/
Copy pathSpec.lean
File metadata and controls
54 lines (39 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import FeProofs.PackedStore.SpecSyntax
import Stele.Semantics
import Stele.SolidityLayout
import Stele.MetaSolidityLayout
import Stele.Refine
import FeProofs.Common.PackedByte
import FeProofs.Common.Storage
/-!
# FePackedStore spec assembly (generated by `scripts/proof_skeleton.py`)
The contract is defined by `SpecSyntax.lean`; this file only names its parts: the transition
handles the proof files unfold, the storage backend (solc layout, from the
declarations), the external-call ABI, and the `Config`.
-/
open Stele ABI
namespace FeProofs.PackedStore
def contract : ContractDecl := Syntax.contractSyntax
/-! ## Transition handles, in `contract.transitions` order -/
abbrev get1Transition : TransitionDecl := contract.transitions[0]! -- get1()
abbrev get0Transition : TransitionDecl := contract.transitions[1]! -- get0()
abbrev setBothTransition : TransitionDecl := contract.transitions[2]! -- setBoth(uint256,uint256)
abbrev set1Transition : TransitionDecl := contract.transitions[3]! -- set1(uint256)
abbrev set0Transition : TransitionDecl := contract.transitions[4]! -- set0(uint256)
/-! ## Storage layout: Fe's `StoragePackedArray<8>` at slot 0
Fe does not use solc's layout for this field: the array's words are the entries of a
`StorageMap<u256, u256>` at the array's slot, so word `w` lies at `keccak256(w ‖ 0)`, and lane `i`
is byte `i` of word 0. `lane0`/`lane1` name lanes 0 and 1. -/
/-- `keccak256(0 ‖ 0)`, word 0 of the packed array whose place is slot 0. -/
def packedSlot : Ethereum.UInt256 := FeProofs.mapSlot ⟨0⟩ ⟨0⟩
def storageLayout : StorageLayout
| { base := "lane0", steps := [] } => some (.leaf (FeProofs.packedByteLoc packedSlot 0))
| { base := "lane1", steps := [] } => some (.leaf (FeProofs.packedByteLoc packedSlot 1))
| _ => none
def storageBackend : StorageBackend := solidityStorageBackend storageLayout
/-! ## Config -/
def config : Config :=
{ storageBackend := storageBackend
externalABI := defaultExternalCallABI
selfDeployment := genSolidityConstructorDeployment contract.ctor.params }
end FeProofs.PackedStore