-
Notifications
You must be signed in to change notification settings - Fork 219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add custom marshaller for GetChainConfigResponse api #546
Changes from all commits
11617d2
4a388f3
d229446
59fc3d6
aaa52f4
228c979
eafd591
9302f75
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,7 @@ import ( | |
|
||
"github.com/ava-labs/subnet-evm/precompile/contracts/nativeminter" | ||
"github.com/ava-labs/subnet-evm/precompile/contracts/rewardmanager" | ||
"github.com/ava-labs/subnet-evm/precompile/contracts/txallowlist" | ||
"github.com/ethereum/go-ethereum/common" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
@@ -227,3 +228,20 @@ func TestActivePrecompiles(t *testing.T) { | |
rules1 := config.AvalancheRules(common.Big0, common.Big1) | ||
require.False(t, rules1.IsPrecompileEnabled(nativeminter.Module.Address)) | ||
} | ||
|
||
func TestChainConfigMarshalWithUpgrades(t *testing.T) { | ||
config := ChainConfigWithUpgradesMarshalled{ | ||
ChainConfig: TestChainConfig, | ||
UpgradeConfig: UpgradeConfig{ | ||
PrecompileUpgrades: []PrecompileUpgrade{ | ||
{ | ||
Config: txallowlist.NewConfig(big.NewInt(100), nil, nil), | ||
}, | ||
}, | ||
}, | ||
} | ||
result, err := json.Marshal(&config) | ||
require.NoError(t, err) | ||
expectedJSON := `{"chainId":1,"feeConfig":{"gasLimit":8000000,"targetBlockRate":2,"minBaseFee":25000000000,"targetGas":15000000,"baseFeeChangeDenominator":36,"minBlockGasCost":0,"maxBlockGasCost":1000000,"blockGasCostStep":200000},"homesteadBlock":0,"eip150Block":0,"eip150Hash":"0x0000000000000000000000000000000000000000000000000000000000000000","eip155Block":0,"eip158Block":0,"byzantiumBlock":0,"constantinopleBlock":0,"petersburgBlock":0,"istanbulBlock":0,"muirGlacierBlock":0,"subnetEVMTimestamp":0,"upgrades":{"precompileUpgrades":[{"txAllowListConfig":{"blockTimestamp":100}}]}}` | ||
require.JSONEq(t, expectedJSON, string(result)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Usually, we'd want to ensure unmarshaled result == There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't currently have a custom unmarshaller for this, so updating this test may need to be a follow on if we want to get this in for the release. |
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need a custom unmarshaler too for them to use?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this may need to be a follow on to get this bug fix in for the release today.