Skip to content

Commit

Permalink
use compiler v2 as default and use v2.1 as test default and receive c…
Browse files Browse the repository at this point in the history
…ompiler and language version as string (#122)
  • Loading branch information
beer-1 authored Sep 10, 2024
1 parent 3318961 commit 15733df
Show file tree
Hide file tree
Showing 135 changed files with 21 additions and 19 deletions.
4 changes: 2 additions & 2 deletions crates/compiler/src/built_package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ impl BuiltPackage {

// use v2 as default
if new_config.compiler_config.compiler_version.is_none() {
new_config.compiler_config.compiler_version = Some(CompilerVersion::V1);
new_config.compiler_config.compiler_version = Some(CompilerVersion::V2_0);
}
if new_config.compiler_config.language_version.is_none() {
new_config.compiler_config.language_version = Some(LanguageVersion::V1);
new_config.compiler_config.language_version = Some(LanguageVersion::V2_0);
}

let (mut package, model_opt) =
Expand Down
2 changes: 1 addition & 1 deletion crates/compiler/src/test_package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl TestPackage {
.known_attributes
.clone_from(metadata::get_all_attribute_names());

// use v2 as default
// use v2.1 as default
if new_build_config.compiler_config.compiler_version.is_none() {
new_build_config.compiler_config.compiler_version = Some(CompilerVersion::V2_1);
}
Expand Down
18 changes: 10 additions & 8 deletions crates/types/src/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ pub struct CompilerBuildConfig {
/// bytecode version. set 0 to unset and to use default
pub bytecode_version: u32,
/// Compiler version. set 0 to unset and to use default
pub compiler_version: u32,
pub compiler_version: String,
/// language version. set 0 to unset and to use default
pub language_version: u32,
pub language_version: String,
/// Additional named address mapping. Useful for tools in rust
pub additional_named_addresses: Vec<(String, AccountAddress)>,
}
Expand All @@ -87,14 +87,16 @@ impl From<CompilerBuildConfig> for BuildConfig {
} else {
Some(val.bytecode_version)
},
compiler_version: match val.compiler_version {
1 => Some(CompilerVersion::V1),
2 => Some(CompilerVersion::V2_1),
compiler_version: match val.compiler_version.as_str() {
"1" | "1.0" => Some(CompilerVersion::V1),
"2" | "2.0" => Some(CompilerVersion::V2_0),
"2.1" => Some(CompilerVersion::V2_1),
_ => None,
},
language_version: match val.language_version {
1 => Some(LanguageVersion::V1),
2 => Some(LanguageVersion::V2_1),
language_version: match val.language_version.as_str() {
"1" | "1.0" => Some(LanguageVersion::V1),
"2" | "2.0" => Some(LanguageVersion::V2_0),
"2.1" => Some(LanguageVersion::V2_1),
_ => None,
},
..Default::default()
Expand Down
Binary file modified precompile/binaries/minlib/account.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/acl.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/address.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/any.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/aptos_hash.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/ascii.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/base64.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/bcs.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/bigdecimal.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/biguint.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/bit_vector.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/block.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/capability.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/code.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/coin.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/collection.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/comparator.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/compare.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/copyable_any.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/cosmos.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/debug.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/dex.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/dispatchable_fungible_asset.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/ed25519.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/error.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/event.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/fixed_point32.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/fixed_point64.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/from_bcs.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/function_info.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/fungible_asset.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/guid.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/hash.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/hex.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/initia_nft.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/json.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/keccak.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/managed_coin.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/math128.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/math64.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/multisig.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/nft.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/object.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/object_code_deployment.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/option.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/oracle.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/primary_fungible_store.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/property_map.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/query.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/royalty.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/secp256k1.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/signer.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/simple_map.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/simple_nft.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/soul_bound_token.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/string.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/string_utils.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/table.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/table_key.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/timestamp.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/transaction_context.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/type_info.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/vector.mv
Binary file not shown.
Binary file modified precompile/binaries/minlib/vip_score.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/account.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/acl.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/address.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/any.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/aptos_hash.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/ascii.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/base64.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/bcs.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/bigdecimal.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/biguint.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/bit_vector.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/block.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/capability.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/code.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/coin.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/collection.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/comparator.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/compare.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/copyable_any.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/cosmos.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/debug.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/dex.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/dispatchable_fungible_asset.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/ed25519.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/error.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/event.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/fixed_point32.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/fixed_point64.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/from_bcs.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/function_info.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/fungible_asset.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/guid.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/hash.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/hex.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/initia_nft.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/json.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/keccak.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/managed_coin.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/math128.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/math64.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/minitswap.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/multisig.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/nft.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/object.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/object_code_deployment.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/option.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/oracle.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/primary_fungible_store.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/property_map.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/query.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/royalty.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/secp256k1.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/signer.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/simple_map.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/simple_nft.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/soul_bound_token.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/stableswap.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/staking.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/string.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/string_utils.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/table.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/table_key.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/timestamp.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/transaction_context.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/type_info.mv
Binary file not shown.
Binary file modified precompile/binaries/stdlib/vector.mv
Binary file not shown.
12 changes: 6 additions & 6 deletions types/bcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ type CompilerBuildConfig struct {
FetchDepsOnly bool
SkipFetchLatestGitDeps bool
BytecodeVersion uint32
CompilerVersion uint32
LanguageVersion uint32
CompilerVersion string
LanguageVersion string
AdditionalNamedAddresses []struct {Field0 string; Field1 AccountAddress}
}

Expand All @@ -172,8 +172,8 @@ func (obj *CompilerBuildConfig) Serialize(serializer serde.Serializer) error {
if err := serializer.SerializeBool(obj.FetchDepsOnly); err != nil { return err }
if err := serializer.SerializeBool(obj.SkipFetchLatestGitDeps); err != nil { return err }
if err := serializer.SerializeU32(obj.BytecodeVersion); err != nil { return err }
if err := serializer.SerializeU32(obj.CompilerVersion); err != nil { return err }
if err := serializer.SerializeU32(obj.LanguageVersion); err != nil { return err }
if err := serializer.SerializeStr(obj.CompilerVersion); err != nil { return err }
if err := serializer.SerializeStr(obj.LanguageVersion); err != nil { return err }
if err := serialize_vector_tuple2_str_AccountAddress(obj.AdditionalNamedAddresses, serializer); err != nil { return err }
serializer.DecreaseContainerDepth()
return nil
Expand All @@ -200,8 +200,8 @@ func DeserializeCompilerBuildConfig(deserializer serde.Deserializer) (CompilerBu
if val, err := deserializer.DeserializeBool(); err == nil { obj.FetchDepsOnly = val } else { return obj, err }
if val, err := deserializer.DeserializeBool(); err == nil { obj.SkipFetchLatestGitDeps = val } else { return obj, err }
if val, err := deserializer.DeserializeU32(); err == nil { obj.BytecodeVersion = val } else { return obj, err }
if val, err := deserializer.DeserializeU32(); err == nil { obj.CompilerVersion = val } else { return obj, err }
if val, err := deserializer.DeserializeU32(); err == nil { obj.LanguageVersion = val } else { return obj, err }
if val, err := deserializer.DeserializeStr(); err == nil { obj.CompilerVersion = val } else { return obj, err }
if val, err := deserializer.DeserializeStr(); err == nil { obj.LanguageVersion = val } else { return obj, err }
if val, err := deserialize_vector_tuple2_str_AccountAddress(deserializer); err == nil { obj.AdditionalNamedAddresses = val } else { return obj, err }
deserializer.DecreaseContainerDepth()
return obj, nil
Expand Down
4 changes: 2 additions & 2 deletions types/compiler/build/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ func WithBytecodeVersion(ver uint32) func(*types.CompilerBuildConfig) {
}
}

func WithCompilerVersion(ver uint32) func(*types.CompilerBuildConfig) {
func WithCompilerVersion(ver string) func(*types.CompilerBuildConfig) {
return func(bc *types.CompilerBuildConfig) {
bc.CompilerVersion = ver
}
}

func WithLanguageVersion(ver uint32) func(*types.CompilerBuildConfig) {
func WithLanguageVersion(ver string) func(*types.CompilerBuildConfig) {
return func(bc *types.CompilerBuildConfig) {
bc.LanguageVersion = ver
}
Expand Down

0 comments on commit 15733df

Please sign in to comment.