Skip to content
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

feat: add e2e test stateful contract #2703

Merged
merged 33 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
d94f788
feat: add test precompiled contract
fbac Aug 14, 2024
b9878a6
feat: add test stateful contract
fbac Aug 14, 2024
40ff210
feat: enable contracts granularly
fbac Aug 14, 2024
83457fc
feat: allow passing the app ctx to contracts
fbac Aug 14, 2024
d13079a
revert ctx changes
fbac Aug 14, 2024
e58c783
format ABI
fbac Aug 14, 2024
eaac523
add first e2e test
fbac Aug 15, 2024
fadf37a
add RegularCaller contract to e2e
fbac Aug 15, 2024
8ad612b
add signer to deployment
fbac Aug 15, 2024
a717f01
fix e2e, use regular abi
fbac Aug 16, 2024
5c88cf1
minor rewording
fbac Aug 16, 2024
f32ff32
use idiomatic errors
fbac Aug 16, 2024
ddee0c5
remove unused files
fbac Aug 19, 2024
c1d41e2
rename and generate bindings automatically
fbac Aug 19, 2024
797dbc4
create a new e2e section for precompiles
fbac Aug 19, 2024
bb69a61
add bindings generator and makefile target
fbac Aug 19, 2024
53098a1
add GetGasStabilityPoolBalance as prototype contract function
fbac Aug 19, 2024
dbe971c
include getGasStabilityPoolBalance function
fbac Aug 19, 2024
906c438
apply code review fixes
fbac Aug 20, 2024
cefb8d2
include tests for precompiles package
fbac Aug 20, 2024
1750644
delete regularcaller
fbac Aug 20, 2024
0f0a517
ignore bindings from codecov
fbac Aug 20, 2024
ee52f66
introduce more unit testing
fbac Aug 20, 2024
3fa0cab
add unit testing for prototype.go
fbac Aug 20, 2024
3a31ddb
minor linting fixes
fbac Aug 20, 2024
fe78f69
remove ctx, keep fungible keeper private
fbac Aug 20, 2024
b62a99e
increase unit tests coverage
fbac Aug 20, 2024
d2bcc79
add keys for new user_precompile
fbac Aug 20, 2024
adbc0a6
add init unit test
fbac Aug 20, 2024
de401aa
switch to double quotes
fbac Aug 20, 2024
f49ac43
avoid go:embed
fbac Aug 20, 2024
ac48e29
fixes derived from code review
fbac Aug 20, 2024
9cbc274
refactor some parts of bech32 functions
fbac Aug 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: enable contracts granularly
  • Loading branch information
fbac committed Aug 14, 2024
commit 40ff210aa29939af8b3e8e7e893fb72add4f9a27
4 changes: 3 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,9 @@ func (app *App) BlockedAddrs() map[string]bool {
}

for addr, enabled := range precompiles.EnabledStatefulContracts {
blockList[addr.String()] = enabled
if enabled {
blockList[addr.String()] = enabled
}
}

return blockList
Expand Down
12 changes: 7 additions & 5 deletions precompiles/precompiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ func StatefulContracts(
precompiledContracts = make([]evmkeeper.CustomContractFn, 0)

// Define the regular contract function.
regularContract := func(_ sdktypes.Context, _ ethparams.Rules) vm.PrecompiledContract {
return regular.NewRegularContract(fungibleKeeper, cdc, gasConfig)
}
if EnabledStatefulContracts[regular.ContractAddress] {
regularContract := func(_ sdktypes.Context, _ ethparams.Rules) vm.PrecompiledContract {
return regular.NewRegularContract(fungibleKeeper, cdc, gasConfig)
}

// Append all the precompiled contracts to the precompiledContracts slice.
precompiledContracts = append(precompiledContracts, regularContract)
// Append the regular contract to the precompiledContracts slice.
precompiledContracts = append(precompiledContracts, regularContract)
}

return precompiledContracts
}
Loading