diff --git a/action/protocol/execution/testdata-london/array-return.sol b/action/protocol/execution/testdata-london/array-return.sol index 29b8eaea13..d779844bd8 100644 --- a/action/protocol/execution/testdata-london/array-return.sol +++ b/action/protocol/execution/testdata-london/array-return.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-3.0 -pragma solidity ^0.8.14; +pragma solidity ^0.8.0; contract A { uint256[] xs; diff --git a/blockchain/config.go b/blockchain/config.go index 3798950fc4..b5133252d5 100644 --- a/blockchain/config.go +++ b/blockchain/config.go @@ -24,14 +24,16 @@ import ( type ( // Config is the config struct for blockchain package Config struct { - ChainDBPath string `yaml:"chainDBPath"` - TrieDBPatchFile string `yaml:"trieDBPatchFile"` - TrieDBPath string `yaml:"trieDBPath"` - StakingPatchDir string `yaml:"stakingPatchDir"` - IndexDBPath string `yaml:"indexDBPath"` - BloomfilterIndexDBPath string `yaml:"bloomfilterIndexDBPath"` - CandidateIndexDBPath string `yaml:"candidateIndexDBPath"` - StakingIndexDBPath string `yaml:"stakingIndexDBPath"` + ChainDBPath string `yaml:"chainDBPath"` + TrieDBPatchFile string `yaml:"trieDBPatchFile"` + TrieDBPath string `yaml:"trieDBPath"` + StakingPatchDir string `yaml:"stakingPatchDir"` + IndexDBPath string `yaml:"indexDBPath"` + BloomfilterIndexDBPath string `yaml:"bloomfilterIndexDBPath"` + CandidateIndexDBPath string `yaml:"candidateIndexDBPath"` + StakingIndexDBPath string `yaml:"stakingIndexDBPath"` + // deprecated + SGDIndexDBPath string `yaml:"sgdIndexDBPath"` ContractStakingIndexDBPath string `yaml:"contractStakingIndexDBPath"` BlobStoreDBPath string `yaml:"blobStoreDBPath"` BlobStoreRetentionDays uint32 `yaml:"blobStoreRetentionDays"` @@ -89,7 +91,11 @@ var ( BloomfilterIndexDBPath: "/var/data/bloomfilter.index.db", CandidateIndexDBPath: "/var/data/candidate.index.db", StakingIndexDBPath: "/var/data/staking.index.db", + SGDIndexDBPath: "/var/data/sgd.index.db", ContractStakingIndexDBPath: "/var/data/contractstaking.index.db", + BlobStoreDBPath: "/var/data/blob.db", + BlobStoreRetentionDays: 20, + BlobPurgeInterval: time.Hour, ID: 1, EVMNetworkID: 4689, Address: "", diff --git a/blockchain/genesis/genesis.go b/blockchain/genesis/genesis.go index 778a958a8b..67bbe0967a 100644 --- a/blockchain/genesis/genesis.go +++ b/blockchain/genesis/genesis.go @@ -330,6 +330,10 @@ type ( SystemStakingContractAddress string `yaml:"systemStakingContractAddress"` // SystemStakingContractHeight is the height of system staking contract SystemStakingContractHeight uint64 `yaml:"systemStakingContractHeight"` + // deprecated + SystemSGDContractAddress string `yaml:"systemSGDContractAddress"` + // deprecated + SystemSGDContractHeight uint64 `yaml:"systemSGDContractHeight"` // SystemStakingContractV2Address is the address of system staking contract SystemStakingContractV2Address string `yaml:"systemStakingContractV2Address"` // SystemStakingContractV2Height is the height of system staking contract diff --git a/config/config_test.go b/config/config_test.go index 644df0fe21..2dc3044cdd 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -11,6 +11,7 @@ import ( "path/filepath" "strings" "testing" + "time" "github.com/iotexproject/go-pkgs/crypto" "github.com/pkg/errors" @@ -309,6 +310,14 @@ func TestValidateActPool(t *testing.T) { ) } +func TestBlobConfig(t *testing.T) { + r := require.New(t) + cfg := Default + blocks := uint32(time.Hour / cfg.DardanellesUpgrade.BlockInterval) + blocks *= cfg.Chain.BlobStoreRetentionDays * 24 + r.EqualValues(345600, blocks) +} + func TestValidateForkHeights(t *testing.T) { r := require.New(t) diff --git a/e2etest/e2etest.go b/e2etest/e2etest.go index e0c8a30123..917baa0df6 100644 --- a/e2etest/e2etest.go +++ b/e2etest/e2etest.go @@ -243,6 +243,8 @@ func initDBPaths(r *require.Assertions, cfg *config.Config) { r.NoError(err) testDBPath, err := testutil.PathOfTempFile("db") r.NoError(err) + testBlobPath, err := testutil.PathOfTempFile("blob") + r.NoError(err) testIndexPath, err := testutil.PathOfTempFile("index") r.NoError(err) testContractIndexPath, err := testutil.PathOfTempFile("contractindex") @@ -259,6 +261,7 @@ func initDBPaths(r *require.Assertions, cfg *config.Config) { cfg.Chain.TrieDBPatchFile = "" cfg.Chain.TrieDBPath = testTriePath cfg.Chain.ChainDBPath = testDBPath + cfg.Chain.BlobStoreDBPath = testBlobPath cfg.Chain.IndexDBPath = testIndexPath cfg.Chain.ContractStakingIndexDBPath = testContractIndexPath cfg.Chain.BloomfilterIndexDBPath = testBloomfilterIndexPath diff --git a/e2etest/local_test.go b/e2etest/local_test.go index 5253a972dd..1492b468fa 100644 --- a/e2etest/local_test.go +++ b/e2etest/local_test.go @@ -47,6 +47,7 @@ const ( _dBPath2 = "db.test2" _triePath = "trie.test" _triePath2 = "trie.test2" + _blobPath = "blob.test" _disabledIP = "169.254." ) @@ -363,6 +364,8 @@ func TestLocalSync(t *testing.T) { require.NoError(err) indexDBPath2, err := testutil.PathOfTempFile(_dBPath2) require.NoError(err) + blobIndexPath, err := testutil.PathOfTempFile(_blobPath) + require.NoError(err) contractIndexDBPath2, err := testutil.PathOfTempFile(_dBPath2) require.NoError(err) @@ -373,11 +376,13 @@ func TestLocalSync(t *testing.T) { cfg.Chain.TrieDBPath = testTriePath2 cfg.Chain.ChainDBPath = testDBPath2 cfg.Chain.IndexDBPath = indexDBPath2 + cfg.Chain.BlobStoreDBPath = blobIndexPath cfg.Chain.ContractStakingIndexDBPath = contractIndexDBPath2 defer func() { testutil.CleanupPath(testTriePath2) testutil.CleanupPath(testDBPath2) testutil.CleanupPath(indexDBPath2) + testutil.CleanupPath(blobIndexPath) testutil.CleanupPath(contractIndexDBPath2) }() @@ -429,12 +434,15 @@ func TestStartExistingBlockchain(t *testing.T) { require.NoError(err) testContractStakeIndexPath, err := testutil.PathOfTempFile(_dBPath) require.NoError(err) + testBlobIndexPath, err := testutil.PathOfTempFile(_blobPath) + require.NoError(err) // Disable block reward to make bookkeeping easier cfg := config.Default cfg.Chain.TrieDBPatchFile = "" cfg.Chain.TrieDBPath = testTriePath cfg.Chain.ChainDBPath = testDBPath cfg.Chain.IndexDBPath = testIndexPath + cfg.Chain.BlobStoreDBPath = testBlobIndexPath cfg.Chain.ContractStakingIndexDBPath = testContractStakeIndexPath cfg.Chain.EnableAsyncIndexWrite = false cfg.ActPool.MinGasPriceStr = "0" @@ -456,6 +464,7 @@ func TestStartExistingBlockchain(t *testing.T) { testutil.CleanupPath(testTriePath) testutil.CleanupPath(testDBPath) testutil.CleanupPath(testIndexPath) + testutil.CleanupPath(testBlobIndexPath) testutil.CleanupPath(testContractStakeIndexPath) }() @@ -540,6 +549,7 @@ func newTestConfig() (config.Config, error) { cfg := config.Default cfg.Chain.TrieDBPath = _triePath cfg.Chain.ChainDBPath = _dBPath + cfg.Chain.BlobStoreDBPath = _blobPath cfg.ActPool.MinGasPriceStr = "0" cfg.Consensus.Scheme = config.NOOPScheme cfg.Network.Port = testutil.RandomPort() diff --git a/e2etest/local_transfer_test.go b/e2etest/local_transfer_test.go index b1eaa60e64..81cf1fa966 100644 --- a/e2etest/local_transfer_test.go +++ b/e2etest/local_transfer_test.go @@ -294,6 +294,8 @@ func TestLocalTransfer(t *testing.T) { require.NoError(err) testDBPath, err := testutil.PathOfTempFile("db") require.NoError(err) + testBlobPath, err := testutil.PathOfTempFile("blob") + require.NoError(err) testIndexPath, err := testutil.PathOfTempFile("index") require.NoError(err) testBloomfilterIndexPath, err := testutil.PathOfTempFile("bloomfilterIndex") @@ -310,6 +312,7 @@ func TestLocalTransfer(t *testing.T) { defer func() { testutil.CleanupPath(testTriePath) testutil.CleanupPath(testDBPath) + testutil.CleanupPath(testBlobPath) testutil.CleanupPath(testIndexPath) testutil.CleanupPath(testSystemLogPath) testutil.CleanupPath(testBloomfilterIndexPath) @@ -320,7 +323,7 @@ func TestLocalTransfer(t *testing.T) { networkPort := 4689 apiPort := testutil.RandomPort() - cfg, err := newTransferConfig(testDBPath, testTriePath, testIndexPath, testBloomfilterIndexPath, testSystemLogPath, testCandidateIndexPath, testContractStakeIndexPath, testContractStakeIndexPathV2, networkPort, apiPort) + cfg, err := newTransferConfig(testDBPath, testTriePath, testBlobPath, testIndexPath, testBloomfilterIndexPath, testSystemLogPath, testCandidateIndexPath, testContractStakeIndexPath, testContractStakeIndexPathV2, networkPort, apiPort) defer func() { delete(cfg.Plugins, config.GatewayPlugin) }() @@ -587,6 +590,7 @@ func getLocalKey(i int) crypto.PrivateKey { func newTransferConfig( chainDBPath, trieDBPath, + blobDBPath, indexDBPath string, bloomfilterIndex string, systemLogDBPath string, @@ -604,6 +608,7 @@ func newTransferConfig( cfg.Chain.ChainDBPath = chainDBPath cfg.Chain.TrieDBPath = trieDBPath cfg.Chain.TrieDBPatchFile = "" + cfg.Chain.BlobStoreDBPath = blobDBPath cfg.Chain.IndexDBPath = indexDBPath cfg.Chain.BloomfilterIndexDBPath = bloomfilterIndex cfg.System.SystemLogDBPath = systemLogDBPath diff --git a/server/itx/server_test.go b/server/itx/server_test.go index af22eb75f1..6a9f03d36c 100644 --- a/server/itx/server_test.go +++ b/server/itx/server_test.go @@ -78,6 +78,8 @@ func newConfig(t *testing.T) (config.Config, func()) { require.NoError(err) indexPath, err := testutil.PathOfTempFile("indxer.db") require.NoError(err) + blobPath, err := testutil.PathOfTempFile("blob.db") + require.NoError(err) contractIndexPath, err := testutil.PathOfTempFile("contractindxer.db") require.NoError(err) contractIndexPathV2, err := testutil.PathOfTempFile("contractindxer.db.v2") @@ -88,12 +90,14 @@ func newConfig(t *testing.T) (config.Config, func()) { cfg.API.WebSocketPort = testutil.RandomPort() cfg.Chain.ChainDBPath = dbPath cfg.Chain.TrieDBPath = triePath + cfg.Chain.BlobStoreDBPath = blobPath cfg.Chain.TrieDBPatchFile = "" cfg.Chain.ContractStakingIndexDBPath = contractIndexPath return cfg, func() { testutil.CleanupPath(dbPath) testutil.CleanupPath(triePath) testutil.CleanupPath(indexPath) + testutil.CleanupPath(blobPath) testutil.CleanupPath(contractIndexPath) testutil.CleanupPath(contractIndexPathV2) }