Skip to content

Commit

Permalink
testing and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
manojkgorle committed Jun 19, 2024
1 parent be8dc64 commit 4aaa29c
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 5 deletions.
2 changes: 1 addition & 1 deletion actions/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const (

MsgComputeUnits = 15

OracleComputeUnits = 1000
OracleComputeUnits = 10

MaxSymbolSize = 8
MaxMemoSize = 256
Expand Down
6 changes: 3 additions & 3 deletions actions/oracle.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func (*Oracle) GetTypeID() uint8 {
}

func (o *Oracle) StateKeys(_ codec.Address, actionID ids.ID) state.Keys {
var keys state.Keys
keys := make(state.Keys, 2*len(o.RelayerIDs))
for _, relayerID := range o.RelayerIDs {
keys.Add(string(storage.RelayerGasPriceKey(relayerID)), state.Allocate|state.Write)
keys.Add(string(storage.RelayerGasPriceUpdateTimeStampKey(relayerID)), state.Allocate|state.Write)
Expand Down Expand Up @@ -71,8 +71,8 @@ func (*Oracle) ComputeUnits(codec.Address, chain.Rules) uint64 {
return OracleComputeUnits
}

func (*Oracle) Size() int {
return consts.IntLen + consts.Uint64Len
func (o *Oracle) Size() int {
return 2*consts.IntLen + 2*len(o.RelayerIDs)*consts.Uint64Len
}

func (o *Oracle) Marshal(p *codec.Packer) {
Expand Down
22 changes: 22 additions & 0 deletions cmd/token-cli/cmd/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ var sequencerMsgCmd = &cobra.Command{
Data: []byte{0x00, 0x01, 0x02},
ChainId: []byte("nkit"),
FromAddress: recipient,
RelayerID: 1,
}}, cli, scli, tcli, factory, true)

hutils.Outf("{{green}}txId:{{/}} %s\n", txId)
Expand Down Expand Up @@ -280,3 +281,24 @@ var mintAssetCmd = &cobra.Command{
return err
},
}

var oracleCmd = &cobra.Command{
Use: "oracle",
RunE: func(*cobra.Command, []string) error {
ctx := context.Background()
_, _, factory, cli, scli, tcli, err := handler.DefaultActor()
if err != nil {
return err
}
// Confirm action
cont, err := handler.Root().PromptContinue()
if !cont || err != nil {
return err
}
_, err = sendAndWait(ctx, []chain.Action{&actions.Oracle{
RelayerIDs: []uint32{1},
UnitGasPrices: []uint64{1},
}}, cli, scli, tcli, factory, true)
return err
},
}
1 change: 1 addition & 0 deletions cmd/token-cli/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ func init() {
mintAssetCmd,

sequencerMsgCmd,
oracleCmd,
)

// spam
Expand Down
1 change: 1 addition & 0 deletions scripts/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ cat <<EOF > "${TMPDIR}"/tokenvm.config
"mempoolSize": 10000000,
"mempoolSponsorSize": 10000000,
"mempoolExemptSponsors":["${ADDRESS}"],
"whitelistedAddresses":["${ADDRESS}"],
"authVerificationCores": 2,
"rootGenerationCores": 2,
"transactionExecutionCores": 2,
Expand Down
2 changes: 1 addition & 1 deletion storage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ func RelayerBalanceKey(relayerID uint32) (k []byte) {
k = make([]byte, 1+consts.Uint32Len+consts.Uint16Len)
k[0] = relayerBalancePrefix
binary.BigEndian.PutUint32(k[1:], relayerID)
binary.BigEndian.PutUint16(k[1+consts.Uint32Len+consts.Uint64Len:], RelayerGasChunks)
binary.BigEndian.PutUint16(k[1+consts.Uint32Len:], RelayerGasChunks)
return k
}

Expand Down
Binary file modified tests/e2e/e2e.test
Binary file not shown.

0 comments on commit 4aaa29c

Please sign in to comment.