Skip to content

Commit

Permalink
Merge pull request #3502 from onflow/feature/atree-register-inlining-…
Browse files Browse the repository at this point in the history
…v1.0
  • Loading branch information
turbolent authored Jul 29, 2024
2 parents e79cdf8 + cce9bcf commit 943d764
Show file tree
Hide file tree
Showing 56 changed files with 3,332 additions and 736 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ require (
github.com/kr/pretty v0.3.1
github.com/leanovate/gopter v0.2.9
github.com/logrusorgru/aurora/v4 v4.0.0
github.com/onflow/atree v0.7.0-rc.2
github.com/onflow/atree v0.8.0-rc.5
github.com/rivo/uniseg v0.4.4
github.com/schollz/progressbar/v3 v3.13.1
github.com/stretchr/testify v1.8.4
github.com/stretchr/testify v1.9.0
github.com/texttheater/golang-levenshtein/levenshtein v0.0.0-20200805054039-cae8b0eaed6c
github.com/tidwall/pretty v1.2.1
github.com/turbolent/prettier v0.0.0-20220320183459-661cc755135d
Expand Down
16 changes: 8 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db h1:62I3jR2Em
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db/go.mod h1:l0dey0ia/Uv7NcFFVbCLtqEBQbrT4OCwCSKTEv6enCw=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/onflow/atree v0.7.0-rc.2 h1:mZmVrl/zPlfI44EjV3FdR2QwIqT8nz1sCONUBFcML/U=
github.com/onflow/atree v0.7.0-rc.2/go.mod h1:xvP61FoOs95K7IYdIYRnNcYQGf4nbF/uuJ0tHf4DRuM=
github.com/onflow/atree v0.8.0-rc.5 h1:1sU+c6UfDzq/EjM8nTw4EI8GvEMarcxkWkJKy6piFSY=
github.com/onflow/atree v0.8.0-rc.5/go.mod h1:yccR+LR7xc1Jdic0mrjocbHvUD7lnVvg8/Ct1AA5zBo=
github.com/onflow/crypto v0.25.0 h1:BeWbLsh3ZD13Ej+Uky6kg1PL1ZIVBDVX+2MVBNwqddg=
github.com/onflow/crypto v0.25.0/go.mod h1:C8FbaX0x8y+FxWjbkHy0Q4EASCDR9bSPWZqlpCLYyVI=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
Expand All @@ -94,12 +94,12 @@ github.com/schollz/progressbar/v3 v3.13.1/go.mod h1:xvrbki8kfT1fzWzBT/UZd9L6GA+j
github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ=
github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/texttheater/golang-levenshtein/levenshtein v0.0.0-20200805054039-cae8b0eaed6c h1:HelZ2kAFadG0La9d+4htN4HzQ68Bm2iM9qKMSMES6xg=
github.com/texttheater/golang-levenshtein/levenshtein v0.0.0-20200805054039-cae8b0eaed6c/go.mod h1:JlzghshsemAMDGZLytTFY8C1JQxQPhnatWqNwUXjggo=
github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4=
Expand Down Expand Up @@ -189,6 +189,6 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
lukechampine.com/blake3 v1.1.7 h1:GgRMhmdsuK8+ii6UZFDL8Nb+VyMwadAgcJyfYHxG6n0=
lukechampine.com/blake3 v1.1.7/go.mod h1:tkKEOtDkNtklkXtLNEOGNq5tcV90tJiA1vAA12R78LA=
lukechampine.com/blake3 v1.3.0 h1:sJ3XhFINmHSrYCgl958hscfIa3bw8x4DqMP3u1YvoYE=
lukechampine.com/blake3 v1.3.0/go.mod h1:0OFRp7fBtAylGVCO40o87sbupkyIGgbpv1+M1k1LM6k=
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
3 changes: 3 additions & 0 deletions migrations/entitlements/migration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1521,6 +1521,7 @@ func TestMigrateSimpleContract(t *testing.T) {
false,
nil,
nil,
true, // standalone values doesn't have a parent container.
)

inter.WriteStored(
Expand Down Expand Up @@ -3207,6 +3208,7 @@ func TestRehash(t *testing.T) {
false,
nil,
nil,
true, // dictValue is standalone
),
)

Expand Down Expand Up @@ -3631,6 +3633,7 @@ func TestUseAfterMigrationFailure(t *testing.T) {
false,
nil,
nil,
true, // dictValue is standalone
),
)

Expand Down
3 changes: 2 additions & 1 deletion migrations/legacy_character_value.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ func (v *LegacyCharacterValue) Transfer(
_ atree.Address,
remove bool,
storable atree.Storable,
_ map[atree.StorageID]struct{},
_ map[atree.ValueID]struct{},
_ bool,
) interpreter.Value {
if remove {
interpreter.RemoveReferencedSlab(storable)
Expand Down
3 changes: 2 additions & 1 deletion migrations/legacy_string_value.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ func (v *LegacyStringValue) Transfer(
_ atree.Address,
remove bool,
storable atree.Storable,
_ map[atree.StorageID]struct{},
_ map[atree.ValueID]struct{},
_ bool,
) interpreter.Value {
if remove {
interpreter.RemoveReferencedSlab(storable)
Expand Down
15 changes: 8 additions & 7 deletions migrations/migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ func (m *StorageMigration) MigrateNestedValue(
)

interpreter.StoredValue(inter, existingStorable, m.storage).
DeepRemove(inter)
DeepRemove(inter, false)
inter.RemoveReferencedSlab(existingStorable)

array.InsertWithoutTransfer(
Expand Down Expand Up @@ -509,9 +509,10 @@ func (m *StorageMigration) migrateDictionaryKeys(

var existingKeys []interpreter.Value

dictionary.IterateKeys(
dictionary.IterateReadOnly(
inter,
func(key interpreter.Value) (resume bool) {
emptyLocationRange,
func(key, _ interpreter.Value) (resume bool) {

existingKeys = append(existingKeys, key)

Expand Down Expand Up @@ -578,7 +579,7 @@ func (m *StorageMigration) migrateDictionaryKeys(

// Remove existing key since old key is migrated
interpreter.StoredValue(inter, existingKeyStorable, m.storage).
DeepRemove(inter)
DeepRemove(inter, false)
inter.RemoveReferencedSlab(existingKeyStorable)

// Convert removed value storable to Value.
Expand Down Expand Up @@ -629,7 +630,7 @@ func (m *StorageMigration) migrateDictionaryKeys(
valueToSet = newValue

// Remove existing value since value is migrated.
existingValue.DeepRemove(inter)
existingValue.DeepRemove(inter, false)
inter.RemoveReferencedSlab(existingValueStorable)
}

Expand Down Expand Up @@ -709,6 +710,7 @@ func (m *StorageMigration) migrateDictionaryValues(

dictionary.Iterate(
inter,
emptyLocationRange,
func(key, value interpreter.Value) (resume bool) {

existingKeysAndValues = append(
Expand All @@ -722,7 +724,6 @@ func (m *StorageMigration) migrateDictionaryValues(
// Continue iteration
return true
},
emptyLocationRange,
)

for _, existingKeyAndValue := range existingKeysAndValues {
Expand Down Expand Up @@ -770,7 +771,7 @@ func (m *StorageMigration) migrateDictionaryValues(

// Remove existing value since value is migrated
interpreter.StoredValue(inter, existingValueStorable, m.storage).
DeepRemove(inter)
DeepRemove(inter, false)
inter.RemoveReferencedSlab(existingValueStorable)
}
}
Expand Down
Loading

0 comments on commit 943d764

Please sign in to comment.