Skip to content

Commit

Permalink
bump movevm and opinit
Browse files Browse the repository at this point in the history
  • Loading branch information
beer-1 committed Aug 14, 2024
1 parent af6fca1 commit 19b6fa1
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 39 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ARG TARGETARCH
ARG GOARCH

# See https://github.com/initia-labs/movevm/releases
ENV LIBMOVEVM_VERSION=v0.3.4
ENV LIBMOVEVM_VERSION=v0.4.0

# Install necessary packages
RUN set -eux; apk add --no-cache ca-certificates build-base git cmake
Expand Down
8 changes: 3 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ require (
github.com/gorilla/mux v1.8.1
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/hashicorp/go-metrics v0.5.3
github.com/initia-labs/OPinit v0.4.1
// we also need to update `LIBMOVEVM_VERSION` of Dockerfile#5
github.com/initia-labs/movevm v0.3.4
github.com/initia-labs/OPinit v0.4.2
// we also need to update `LIBMOVEVM_VERSION` of Dockerfile#9
github.com/initia-labs/movevm v0.4.0
github.com/noble-assets/forwarding/v2 v2.0.0-20240521090705-86712c4c9e43
github.com/pelletier/go-toml v1.9.5
github.com/pkg/errors v0.9.1
Expand Down Expand Up @@ -237,5 +237,3 @@ replace (
// replace broken goleveldb
github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
)

replace github.com/initia-labs/movevm => ../movevm
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -727,12 +727,14 @@ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANyt
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo=
github.com/initia-labs/OPinit v0.4.1 h1:g6IVEAOe2X31pgjk/q0zg4R1GfNj2QP3q5s3HMcWm8w=
github.com/initia-labs/OPinit v0.4.1/go.mod h1:n0eqwOnVGE1vuTnW+3jzyEXfE4ndTM0vCRGmPu9VvUc=
github.com/initia-labs/OPinit v0.4.2 h1:cfE6LXb3EquDK1/UTDT62o9c2HOQL0E9pWTr5BWAf8g=
github.com/initia-labs/OPinit v0.4.2/go.mod h1:bM+tav+ER4uC6U84PB5vgnRUNyjc/phNgHGYQX9ALhg=
github.com/initia-labs/OPinit/api v0.4.1 h1:Q8etW92LiwekKZxzDYVFdiHF3uOpEA4nyajy8zpcxB0=
github.com/initia-labs/OPinit/api v0.4.1/go.mod h1:Xy/Nt3ubXLQ4zKn0m7RuQOM1sj8TVdlNNyek21TGYR0=
github.com/initia-labs/cometbft v0.0.0-20240802022359-e0a5ce0336b6 h1:ObKvj9nGiKE+MWZ/LnH3rPcXsnBVVn4c30/iw+fMsd4=
github.com/initia-labs/cometbft v0.0.0-20240802022359-e0a5ce0336b6/go.mod h1:jHPx9vQpWzPHEAiYI/7EDKaB1NXhK6o3SArrrY8ExKc=
github.com/initia-labs/movevm v0.4.0 h1:nqEa4b5ujmCf0hTrqst8M9N/MCMg5eU8BZYMkMa7tYc=
github.com/initia-labs/movevm v0.4.0/go.mod h1:6MxR4GP5zH3JUc1IMgfqAe1e483mZVS7fshPknZPJ30=
github.com/jhump/protoreflect v1.15.3 h1:6SFRuqU45u9hIZPJAoZ8c28T3nK64BNdp9w6jFonzls=
github.com/jhump/protoreflect v1.15.3/go.mod h1:4ORHmSBmlCW8fh3xHmJMGyul1zNqZK4Elxc8qKP+p1k=
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
Expand Down
2 changes: 1 addition & 1 deletion x/move/keeper/bank_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ func Test_BurnCoins(t *testing.T) {
vmtypes.TestAddress,
vmtypes.StdAddress,
"managed_coin",
"mint",
"mint_to",
[]vmtypes.TypeTag{},
[]string{fmt.Sprintf("\"%s\"", vmtypes.TestAddress.String()), fmt.Sprintf("\"%s\"", barMetadata.String()), `"1000000"`},
)
Expand Down
10 changes: 0 additions & 10 deletions x/move/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"golang.org/x/crypto/sha3"

moveconfig "github.com/initia-labs/initia/x/move/config"
"github.com/initia-labs/initia/x/move/types"
Expand Down Expand Up @@ -175,13 +174,6 @@ func (k Keeper) SetModule(
return err
}

checksum := sha3.Sum256(moduleBytes)
if checksumKey, err := types.GetChecksumKey(addr, moduleName); err != nil {
return err
} else if err := k.VMStore.Set(ctx, checksumKey, checksum[:]); err != nil {
return err
}

return nil
}

Expand Down Expand Up @@ -549,8 +541,6 @@ func (k Keeper) IterateVMStore(ctx context.Context, cb func(*types.Module, *type
KeyBytes: key[cursor:],
ValueBytes: value,
})
} else if separator == types.ChecksumSeparator {
// ignore checksum
} else {
return true, errors.New("unknown prefix")
}
Expand Down
23 changes: 3 additions & 20 deletions x/move/types/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,9 @@ var (
ParamsKey = []byte{0x31} // prefix for parameters for module x/move

ModuleSeparator = byte(0)
ChecksumSeparator = byte(1)
ResourceSeparator = byte(2)
TableEntrySeparator = byte(3)
TableInfoSeparator = byte(4)
ResourceSeparator = byte(1)
TableEntrySeparator = byte(2)
TableInfoSeparator = byte(3)
)

// GetModulePrefix returns the prefix key of an account module store
Expand All @@ -87,22 +86,6 @@ func GetModuleKey(addr vmtypes.AccountAddress, moduleName string) ([]byte, error
return append(append(addr.Bytes(), ModuleSeparator), bz...), nil
}

// GetChecksumPrefix returns the prefix key of an account module checksum store
func GetChecksumPrefix(addr vmtypes.AccountAddress) []byte {
return append(addr.Bytes(), ChecksumSeparator)
}

// GetChecksumKey returns the key of the published move module checksum
func GetChecksumKey(addr vmtypes.AccountAddress, moduleName string) ([]byte, error) {
identifier := vmtypes.Identifier(moduleName)
bz, err := identifier.BcsSerialize()
if err != nil {
return nil, err
}

return append(append(addr.Bytes(), ChecksumSeparator), bz...), nil
}

// GetResourcePrefix returns the prefix key of an account resource store
func GetResourcePrefix(addr vmtypes.AccountAddress) []byte {
return append(addr.Bytes(), ResourceSeparator)
Expand Down

0 comments on commit 19b6fa1

Please sign in to comment.