Skip to content

Commit 3e85e49

Browse files
committed
adjust expected state commitments
1 parent 312e41a commit 3e85e49

File tree

4 files changed

+10
-39
lines changed

4 files changed

+10
-39
lines changed

engine/execution/state/bootstrap/bootstrap_test.go

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
"github.com/onflow/flow-go/engine/execution/state"
1313
"github.com/onflow/flow-go/engine/execution/storehouse"
1414
"github.com/onflow/flow-go/fvm"
15-
"github.com/onflow/flow-go/fvm/cadence_vm"
1615
"github.com/onflow/flow-go/fvm/systemcontracts"
1716
completeLedger "github.com/onflow/flow-go/ledger/complete"
1817
"github.com/onflow/flow-go/ledger/complete/wal/fixtures"
@@ -58,10 +57,9 @@ func TestBootstrapLedger(t *testing.T) {
5857
}
5958

6059
func TestBootstrapLedger_ZeroTokenSupply(t *testing.T) {
61-
expectedStateCommitmentBytes, _ := hex.DecodeString(ifCompile(
62-
"3ee915c0ecaf1399d00cc6a768517aa074139ca07045d4e63a1745fc81e1bdf0",
63-
"bec4478e1b3aa1fd822c796411e69bd85ef9529b9ef93e231d4b02470d49b4f0",
64-
))
60+
expectedStateCommitmentBytes, _ := hex.DecodeString(
61+
"4c71561153301a0dea2e6cc74255ff6473b5ef4b66c7701bbcf8358249ce2048",
62+
)
6563
expectedStateCommitment, err := flow.ToStateCommitment(expectedStateCommitmentBytes)
6664
require.NoError(t, err)
6765

@@ -97,13 +95,6 @@ func TestBootstrapLedger_ZeroTokenSupply(t *testing.T) {
9795
})
9896
}
9997

100-
func ifCompile[T any](a, b T) T {
101-
if cadence_vm.DefaultEnabled {
102-
return a
103-
}
104-
return b
105-
}
106-
10798
// TestBootstrapLedger_EmptyTransaction bootstraps a ledger with:
10899
// - transaction fees
109100
// - storage fees
@@ -116,10 +107,7 @@ func ifCompile[T any](a, b T) T {
116107
// This tests that the state commitment has not changed for the bookkeeping parts of the transaction.
117108
func TestBootstrapLedger_EmptyTransaction(t *testing.T) {
118109
expectedStateCommitmentBytes, _ := hex.DecodeString(
119-
ifCompile(
120-
"505aa62b494f262df6830b4ace90ee35d5e4574155db4361eff5e97ae4377d31",
121-
"b21c4cea6518d92c34d2eeff1a02f7e1b7b75f9c0e0e52069905bb728361d039",
122-
),
110+
"def8795537883765992fda2ef6aafd6b0448bd0cf514f551ee7e7803cd13d11f",
123111
)
124112
expectedStateCommitment, err := flow.ToStateCommitment(expectedStateCommitmentBytes)
125113
require.NoError(t, err)

fvm/environment/programs_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,7 @@ func Test_ProgramsDoubleCounting(t *testing.T) {
790790
// hit B because interpreting C because interpreting transaction
791791
// hit A because interpreting B because interpreting C because interpreting transaction
792792
// hit A2 because interpreting B because interpreting C because interpreting transaction
793-
require.Equal(t, ifCompile(33, 7), metrics.CacheHits)
793+
require.Equal(t, ifCompile(15, 7), metrics.CacheHits)
794794
require.Equal(t, 4, metrics.CacheMisses)
795795
})
796796

fvm/evm/emulator/state/collection.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,8 @@ func (v ByteStringValue) StoredValue(_ atree.SlabStorage) (atree.Value, error) {
257257
return v, nil
258258
}
259259

260-
func (v ByteStringValue) Storable(storage atree.SlabStorage, address atree.Address, maxInlineSize uint64) (atree.Storable, error) {
261-
if uint64(v.ByteSize()) <= maxInlineSize {
260+
func (v ByteStringValue) Storable(storage atree.SlabStorage, address atree.Address, maxInlineSize uint32) (atree.Storable, error) {
261+
if v.ByteSize() <= maxInlineSize {
262262
return v, nil
263263
}
264264

utils/unittest/execution_state.go

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"github.com/onflow/crypto"
99
"github.com/onflow/crypto/hash"
1010

11-
"github.com/onflow/flow-go/fvm/cadence_vm"
1211
"github.com/onflow/flow-go/model/flow"
1312
)
1413

@@ -24,10 +23,7 @@ const ServiceAccountPrivateKeySignAlgo = crypto.ECDSAP256
2423
const ServiceAccountPrivateKeyHashAlgo = hash.SHA2_256
2524

2625
// Pre-calculated state commitment with root account with the above private key
27-
var GenesisStateCommitmentHex = ifCompile(
28-
"2aec1528d538f64d05d0fd7e1726f9bb5fd46ec904d2df87212c308235affc94",
29-
"002ec8b7ddc16a5f057539433ab9e4190806a231a0ca00a1c666745c44104121",
30-
)
26+
var GenesisStateCommitmentHex = "8067eed3686a4193222fd59091aab352f5aba345013425f125b01566ffa8af49"
3127

3228
var GenesisStateCommitment flow.StateCommitment
3329

@@ -86,28 +82,15 @@ func GenesisStateCommitmentByChainID(chainID flow.ChainID) flow.StateCommitment
8682
return commit
8783
}
8884

89-
func ifCompile[T any](a, b T) T {
90-
if cadence_vm.DefaultEnabled {
91-
return a
92-
}
93-
return b
94-
}
95-
9685
func genesisCommitHexByChainID(chainID flow.ChainID) string {
9786
if chainID == flow.Mainnet {
9887
return GenesisStateCommitmentHex
9988
}
10089
if chainID == flow.Testnet {
101-
return ifCompile(
102-
"85a5558c2a25a655d68fdcb29d4fa4dc457d86425da11d9ae7a1edd2dc859e2a",
103-
"475d23a46aed725c9663bf77e8b41ab569d57bd52529840b38e730d031d662bf",
104-
)
90+
return "deae6a293742711f720dfaa04daefac686e21055d98fe4bfc110376cbc53b817"
10591
}
10692
if chainID == flow.Sandboxnet {
10793
return "e1c08b17f9e5896f03fe28dd37ca396c19b26628161506924fbf785834646ea1"
10894
}
109-
return ifCompile(
110-
"848de583931aaeb3eaf2cf144c5ad53df0d4704a7798205dc3e752e1e63d23a1",
111-
"6a3bc6034668d0a8ce4e95e61482d9c729d8075b96e378d4583cf4398b3f3863",
112-
)
95+
return "7b1ba932c47835fab32271f47be7de2b0dac5155ef111ae4adeb0df9adf26c2a"
11396
}

0 commit comments

Comments
 (0)