Skip to content

Commit be4e53f

Browse files
g3coborispovod
andauthored
[DFI-632] migrate to new DVM resp format (#191)
* [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>
1 parent 476c360 commit be4e53f

19 files changed

Lines changed: 521 additions & 410 deletions

File tree

docs/genesis_generation.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ It should be done before the next commands, refer to the tutorial **[how to init
6262
The following commands might be omitted as [`xfi`, `eth`, `usdt`, `btc`] currencies already exist in the default generated genesis above.
6363
Currencies can be added to the chain later using `gov` proposals.
6464

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

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

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ require (
1010
github.com/containerd/containerd v1.3.3 // indirect
1111
github.com/containerd/continuity v0.0.0-20200228182428-0f16d7a0959c // indirect
1212
github.com/cosmos/cosmos-sdk v0.39.0
13-
github.com/dfinance/dvm-proto/go v0.0.0-20200629145843-bfdcef619a26
13+
github.com/dfinance/dvm-proto/go v0.0.0-20200806082036-06b76cf8c183
1414
github.com/dfinance/glav v0.0.0-20200731202515-8e21f58877c8
1515
github.com/dfinance/lcs v0.1.7-big
1616
github.com/fsouza/go-dockerclient v1.6.3

go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,12 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
150150
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
151151
github.com/dfinance/dvm-proto/go v0.0.0-20200629145843-bfdcef619a26 h1:HjCcumhDVs5KmXxy7AAzcRzHVaHF3msBoWCpSewdFAc=
152152
github.com/dfinance/dvm-proto/go v0.0.0-20200629145843-bfdcef619a26/go.mod h1:Vt1T0G56AYXbsduNKzSkq1RDTNa8PFraSqB9DaTCV0U=
153+
github.com/dfinance/dvm-proto/go v0.0.0-20200806082036-06b76cf8c183 h1:h1gLIUPEbVIVHSrJvC9FPpaVKHXmVmUYAoEEoH/ZxeE=
154+
github.com/dfinance/dvm-proto/go v0.0.0-20200806082036-06b76cf8c183/go.mod h1:Vt1T0G56AYXbsduNKzSkq1RDTNa8PFraSqB9DaTCV0U=
153155
github.com/dfinance/glav v0.0.0-20200731202515-8e21f58877c8 h1:SpACwa85hu9vFveIBPE4Xe28KiSrwxU8Lge3Pcdtr8s=
154156
github.com/dfinance/glav v0.0.0-20200731202515-8e21f58877c8/go.mod h1:/0gr38+QzVxCNSNKc/WjGKtdTfV8NtMagCNO0/VjOQU=
157+
github.com/dfinance/glav v0.0.0-20200810142408-b45f02eb7f56 h1:fHl+W6KAqVKdTmwpmpAQX8z0ZSH4qf3FS4X/dNJk3cc=
158+
github.com/dfinance/glav v0.0.0-20200810142408-b45f02eb7f56/go.mod h1:/0gr38+QzVxCNSNKc/WjGKtdTfV8NtMagCNO0/VjOQU=
155159
github.com/dfinance/lcs v0.1.7-big h1:z+Pvxcxvr6lKSy1vjYJtM5MnCTQ7DBjPitTywoWO9X0=
156160
github.com/dfinance/lcs v0.1.7-big/go.mod h1:0Ir8JvbtxibZYvgTrRbbjNjk2EImCEXOJc3WHuUaSzI=
157161
github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4=

helpers/tests/mockdvm/mockdvm.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,12 @@ func (s *MockDVM) PublishModule(ctx context.Context, in *vm_grpc.VMPublishModule
5555
resp := &vm_grpc.VMExecuteResponse{}
5656
if !s.failResponse {
5757
resp = &vm_grpc.VMExecuteResponse{
58-
WriteSet: nil,
59-
Events: nil,
60-
GasUsed: 1,
61-
Status: vm_grpc.ContractStatus_Discard,
62-
StatusStruct: nil,
58+
WriteSet: nil,
59+
Events: nil,
60+
GasUsed: 1,
61+
Status: &vm_grpc.VMStatus{
62+
Error: &vm_grpc.VMStatus_Abort{},
63+
},
6364
}
6465
}
6566

x/ccstorage/internal/types/genesis.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ func DefaultGenesisState() GenesisState {
7373
{
7474
Denom: "xfi",
7575
Decimals: 18,
76-
BalancePathHex: "01608540feb9c6bd277405cfdc0e9140c1431f236f7d97865575e830af3dd67e7e",
77-
InfoPathHex: "01f3a1f15d7b13931f3bd5f957ad154b5cbaa0e1a2c3d4d967f286e8800eeb510d",
76+
BalancePathHex: "01226844e85ad6e3867f4ff1a4300e71ed6057538631a5a5330512772b7104b585",
77+
InfoPathHex: "01b9ed21c23abf8c7a53fb868a36e106d45394c30127fb722f8dd2d45aae719585",
7878
},
7979
{
8080
Denom: "eth",

x/vm/internal/keeper/common_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ func (server vmServer) PublishModule(context.Context, *vm_grpc.VMPublishModule)
115115
WriteSet: values,
116116
Events: nil,
117117
GasUsed: 10000,
118-
Status: vm_grpc.ContractStatus_Keep,
118+
Status: &vm_grpc.VMStatus{},
119119
}, nil
120120
}
121121

@@ -148,7 +148,7 @@ func (server vmServer) ExecuteScript(context.Context, *vm_grpc.VMExecuteScript)
148148
WriteSet: values,
149149
Events: events,
150150
GasUsed: 10000,
151-
Status: vm_grpc.ContractStatus_Keep,
151+
Status: &vm_grpc.VMStatus{},
152152
}, nil
153153
}
154154

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

282283
// create keepers
283284
input.pk = params.NewKeeper(input.cdc, input.keyParams, input.tkeyParams)

0 commit comments

Comments
 (0)