Skip to content

Commit

Permalink
chore: remove deltas from imports.go
Browse files Browse the repository at this point in the history
  • Loading branch information
EclesioMeloJunior committed Feb 7, 2024
1 parent 8cce14e commit d918b99
Showing 1 changed file with 21 additions and 27 deletions.
48 changes: 21 additions & 27 deletions lib/runtime/wazero/imports.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,23 +92,22 @@ func ext_logging_log_version_1(ctx context.Context, m api.Module, level int32, t
target := string(read(m, targetData))
msg := string(read(m, msgData))

line := fmt.Sprintf("target=%s message=%s\n", target, msg)
fmt.Print(line)

// switch int(level) {
// case 0:
// logger.Critical(line)
// case 1:
// logger.Warn(line)
// case 2:
// logger.Info(line)
// case 3:
// logger.Debug(line)
// case 4:
// logger.Trace(line)
// default:
// logger.Errorf("level=%d target=%s message=%s", int(level), target, msg)
// }
line := fmt.Sprintf("target=%s message=%s", target, msg)

switch int(level) {
case 0:
logger.Critical(line)
case 1:
logger.Warn(line)
case 2:
logger.Info(line)
case 3:
logger.Debug(line)
case 4:
logger.Trace(line)
default:
logger.Errorf("level=%d target=%s message=%s", int(level), target, msg)
}
}

func ext_crypto_ed25519_generate_version_1(
Expand Down Expand Up @@ -838,16 +837,12 @@ func ext_trie_blake2_256_ordered_root_version_2(

data := read(m, dataSpan)

fmt.Printf("ext_trie_blake2_256_ordered_root_version_2 with pre parse: %v\n", version)

stateVersion, err := trie.ParseVersion(version)
if err != nil {
logger.Errorf("failed parsing state version: %s", err)
return 0
}

fmt.Printf("ext_trie_blake2_256_ordered_root_version_2 with pos parse: %s\n", stateVersion.String())

var values [][]byte
err = scale.Unmarshal(data, &values)
if err != nil {
Expand Down Expand Up @@ -880,7 +875,7 @@ func ext_trie_blake2_256_ordered_root_version_2(
return 0
}

fmt.Printf("root hash is %s\n", hash)
logger.Debugf("root hash is %s", hash)
m.Memory().Write(ptr, hash[:])
return ptr
}
Expand Down Expand Up @@ -2098,7 +2093,7 @@ func ext_storage_clear_prefix_version_1(ctx context.Context, m api.Module, prefi
storage := rtCtx.Storage

prefix := read(m, prefixSpan)
fmt.Printf("[ext_storage_clear_prefix_version_1] prefix: 0x%x\n", prefix)
logger.Debugf("prefix: 0x%x", prefix)

err := storage.ClearPrefix(prefix)
if err != nil {
Expand Down Expand Up @@ -2136,6 +2131,8 @@ func ext_storage_clear_prefix_version_2(ctx context.Context, m api.Module, prefi
storage := rtCtx.Storage

prefix := read(m, prefixSpan)
logger.Debugf("prefix: 0x%x", prefix)

limitBytes := read(m, lim)

var limit []byte
Expand All @@ -2158,9 +2155,6 @@ func ext_storage_clear_prefix_version_2(ctx context.Context, m api.Module, prefi
panic(err)
}

fmt.Printf("[ext_storage_clear_prefix_version_2] prefix: 0x%x, lim: %d, removed: %d, all: %v\n",
prefix, limitUint, numRemoved, all)

encBytes, err := toKillStorageResultEnum(all, numRemoved)
if err != nil {
logger.Errorf("failed to allocate memory: %s", err)
Expand Down Expand Up @@ -2228,7 +2222,7 @@ func ext_storage_next_key_version_1(ctx context.Context, m api.Module, keySpan u

next := storage.NextKey(key)
logger.Debugf(
"[ext_storage_next_key_version_1] key: 0x%x; next key 0x%x",
"key: 0x%x; next key 0x%x",
key, next)

var encodedOption []byte
Expand Down

0 comments on commit d918b99

Please sign in to comment.