Skip to content

Commit

Permalink
[DFI-632] migrate to new DVM resp format (#191)
Browse files Browse the repository at this point in the history
* [DFI-632] Migrate to new dvm response structure

* [DFI-632] Fixed max gas value for VM

* [DFI-632] fixed XFI

* [DFI-632] added status codes

* [DFI-632] fixed linter

* [DFI-632] refactored utils

* fix to genesis gen doc

* [DFI-632] refactoring

Co-authored-by: borispovod <boris@wings.ai>
  • Loading branch information
g3co and borispovod authored Aug 24, 2020
1 parent 476c360 commit be4e53f
Show file tree
Hide file tree
Showing 19 changed files with 521 additions and 410 deletions.
8 changes: 4 additions & 4 deletions docs/genesis_generation.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ It should be done before the next commands, refer to the tutorial **[how to init
The following commands might be omitted as [`xfi`, `eth`, `usdt`, `btc`] currencies already exist in the default generated genesis above.
Currencies can be added to the chain later using `gov` proposals.

dnode set-currency-info xfi 18 01608540feb9c6bd277405cfdc0e9140c1431f236f7d97865575e830af3dd67e7e 01f3a1f15d7b13931f3bd5f957ad154b5cbaa0e1a2c3d4d967f286e8800eeb510d
dnode set-currency-info eth 18 0138f4f2895881c804de0e57ced1d44f02e976f9c6561c889f7b7eef8e660d2c9a 012a00668b5325f832c28a24eb83dffa8295170c80345fbfbf99a5263f962c76f4
dnode set-currency-info usdt 6 01a04b6467f35792e0fda5638a509cc807b3b289a4e0ea10794c7db5dc1a63d481 01d058943a984bc02bc4a8547e7c0d780c59334e9aa415b90c87e70d140b2137b8
dnode set-currency-info btc 8 019a2b233aea4cab2e5b6701280f8302be41ea5731af93858fd96e038499eda072 019fdf92aeba5356ec5455b1246c2e1b71d5c7192c6e5a1b50444dafaedc1c40c9
dnode set-currency xfi 18 01226844e85ad6e3867f4ff1a4300e71ed6057538631a5a5330512772b7104b585 01b9ed21c23abf8c7a53fb868a36e106d45394c30127fb722f8dd2d45aae719585
dnode set-currency eth 18 0138f4f2895881c804de0e57ced1d44f02e976f9c6561c889f7b7eef8e660d2c9a 012a00668b5325f832c28a24eb83dffa8295170c80345fbfbf99a5263f962c76f4
dnode set-currency usdt 6 01a04b6467f35792e0fda5638a509cc807b3b289a4e0ea10794c7db5dc1a63d481 01d058943a984bc02bc4a8547e7c0d780c59334e9aa415b90c87e70d140b2137b8
dnode set-currency btc 8 019a2b233aea4cab2e5b6701280f8302be41ea5731af93858fd96e038499eda072 019fdf92aeba5356ec5455b1246c2e1b71d5c7192c6e5a1b50444dafaedc1c40c9

We can also add DEX markets to genesis (markets can be added later via non-genesis Tx command as well):

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/containerd/containerd v1.3.3 // indirect
github.com/containerd/continuity v0.0.0-20200228182428-0f16d7a0959c // indirect
github.com/cosmos/cosmos-sdk v0.39.0
github.com/dfinance/dvm-proto/go v0.0.0-20200629145843-bfdcef619a26
github.com/dfinance/dvm-proto/go v0.0.0-20200806082036-06b76cf8c183
github.com/dfinance/glav v0.0.0-20200731202515-8e21f58877c8
github.com/dfinance/lcs v0.1.7-big
github.com/fsouza/go-dockerclient v1.6.3
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,12 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dfinance/dvm-proto/go v0.0.0-20200629145843-bfdcef619a26 h1:HjCcumhDVs5KmXxy7AAzcRzHVaHF3msBoWCpSewdFAc=
github.com/dfinance/dvm-proto/go v0.0.0-20200629145843-bfdcef619a26/go.mod h1:Vt1T0G56AYXbsduNKzSkq1RDTNa8PFraSqB9DaTCV0U=
github.com/dfinance/dvm-proto/go v0.0.0-20200806082036-06b76cf8c183 h1:h1gLIUPEbVIVHSrJvC9FPpaVKHXmVmUYAoEEoH/ZxeE=
github.com/dfinance/dvm-proto/go v0.0.0-20200806082036-06b76cf8c183/go.mod h1:Vt1T0G56AYXbsduNKzSkq1RDTNa8PFraSqB9DaTCV0U=
github.com/dfinance/glav v0.0.0-20200731202515-8e21f58877c8 h1:SpACwa85hu9vFveIBPE4Xe28KiSrwxU8Lge3Pcdtr8s=
github.com/dfinance/glav v0.0.0-20200731202515-8e21f58877c8/go.mod h1:/0gr38+QzVxCNSNKc/WjGKtdTfV8NtMagCNO0/VjOQU=
github.com/dfinance/glav v0.0.0-20200810142408-b45f02eb7f56 h1:fHl+W6KAqVKdTmwpmpAQX8z0ZSH4qf3FS4X/dNJk3cc=
github.com/dfinance/glav v0.0.0-20200810142408-b45f02eb7f56/go.mod h1:/0gr38+QzVxCNSNKc/WjGKtdTfV8NtMagCNO0/VjOQU=
github.com/dfinance/lcs v0.1.7-big h1:z+Pvxcxvr6lKSy1vjYJtM5MnCTQ7DBjPitTywoWO9X0=
github.com/dfinance/lcs v0.1.7-big/go.mod h1:0Ir8JvbtxibZYvgTrRbbjNjk2EImCEXOJc3WHuUaSzI=
github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4=
Expand Down
11 changes: 6 additions & 5 deletions helpers/tests/mockdvm/mockdvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,12 @@ func (s *MockDVM) PublishModule(ctx context.Context, in *vm_grpc.VMPublishModule
resp := &vm_grpc.VMExecuteResponse{}
if !s.failResponse {
resp = &vm_grpc.VMExecuteResponse{
WriteSet: nil,
Events: nil,
GasUsed: 1,
Status: vm_grpc.ContractStatus_Discard,
StatusStruct: nil,
WriteSet: nil,
Events: nil,
GasUsed: 1,
Status: &vm_grpc.VMStatus{
Error: &vm_grpc.VMStatus_Abort{},
},
}
}

Expand Down
4 changes: 2 additions & 2 deletions x/ccstorage/internal/types/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ func DefaultGenesisState() GenesisState {
{
Denom: "xfi",
Decimals: 18,
BalancePathHex: "01608540feb9c6bd277405cfdc0e9140c1431f236f7d97865575e830af3dd67e7e",
InfoPathHex: "01f3a1f15d7b13931f3bd5f957ad154b5cbaa0e1a2c3d4d967f286e8800eeb510d",
BalancePathHex: "01226844e85ad6e3867f4ff1a4300e71ed6057538631a5a5330512772b7104b585",
InfoPathHex: "01b9ed21c23abf8c7a53fb868a36e106d45394c30127fb722f8dd2d45aae719585",
},
{
Denom: "eth",
Expand Down
5 changes: 3 additions & 2 deletions x/vm/internal/keeper/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func (server vmServer) PublishModule(context.Context, *vm_grpc.VMPublishModule)
WriteSet: values,
Events: nil,
GasUsed: 10000,
Status: vm_grpc.ContractStatus_Keep,
Status: &vm_grpc.VMStatus{},
}, nil
}

Expand Down Expand Up @@ -148,7 +148,7 @@ func (server vmServer) ExecuteScript(context.Context, *vm_grpc.VMExecuteScript)
WriteSet: values,
Events: events,
GasUsed: 10000,
Status: vm_grpc.ContractStatus_Keep,
Status: &vm_grpc.VMStatus{},
}, nil
}

Expand Down Expand Up @@ -278,6 +278,7 @@ func newTestInput(launchMock bool) testInput {
panic(err)
}
input.ctx = sdk.NewContext(mstore, abci.Header{ChainID: "dn-testnet-vm-keeper-test"}, false, logger)
input.ctx = input.ctx.WithGasMeter(sdk.NewGasMeter(10000000))

// create keepers
input.pk = params.NewKeeper(input.cdc, input.keyParams, input.tkeyParams)
Expand Down
Loading

0 comments on commit be4e53f

Please sign in to comment.