Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Stable Cadence feature branch #5412

Merged
merged 83 commits into from
Feb 20, 2024

Conversation

turbolent
Copy link
Member

@turbolent turbolent commented Feb 17, 2024

Work towards onflow/cadence#3115

Conflict resolution
commit c111805fa03d7d47644e7d28351dde0299014283
Merge: 33b37f1229 6976a4d55a
Author: Bastian Müller <bastian@turbolent.com>
Date:   Sat Feb 17 13:55:47 2024 -0800

    Merge branch 'master' into bastian/update-stable-cadence-10

diff --git a/fvm/evm/evm_test.go b/fvm/evm/evm_test.go
remerge CONFLICT (content): Merge conflict in fvm/evm/evm_test.go
index b4fcfeea16..a639d2c243 100644
--- a/fvm/evm/evm_test.go
+++ b/fvm/evm/evm_test.go
@@ -329,26 +329,17 @@ func TestCadenceArch(t *testing.T) {
 					import EVM from %s
 
 					transaction {
-<<<<<<< 33b37f1229 (Merge pull request #5400 from onflow/supun/sync-stable-cadence-master)
 						prepare(account: auth(Capabilities, SaveValue) &Account) {
-							let bridgedAccount1 <- EVM.createBridgedAccount()
+							let cadenceOwnedAccount <- EVM.createCadenceOwnedAccount()
 
-							account.storage.save<@EVM.BridgedAccount>(
-							    <-bridgedAccount1,
-							    to: /storage/bridgedAccount
+							account.storage.save(
+                                <-cadenceOwnedAccount,
+								to: /storage/coa
                             )
 
-							let bridgedAccount = account.capabilities.storage
-							    .issue<&EVM.BridgedAccount>(/storage/bridgedAccount)
-							account.capabilities.publish(bridgedAccount, at: /public/bridgedAccount)
-=======
-						prepare(account: AuthAccount) {
-							let cadenceOwnedAccount1 <- EVM.createCadenceOwnedAccount()
-							account.save<@EVM.CadenceOwnedAccount>(<-cadenceOwnedAccount1,
-																to: /storage/coa)
-							account.link<&EVM.CadenceOwnedAccount{EVM.Addressable}>(/public/coa,
-																				target: /storage/coa)
->>>>>>> 6976a4d55a (Merge pull request #5381 from onflow/ramtin/5380-rename-bridge-account)
+							let cap = account.capabilities.storage
+							    .issue<&EVM.CadenceOwnedAccount>(/storage/coa)
+							account.capabilities.publish(cap, at: /public/coa)
 						}
 					}
                 `,
diff --git a/fvm/evm/stdlib/contract.cdc b/fvm/evm/stdlib/contract.cdc
remerge CONFLICT (content): Merge conflict in fvm/evm/stdlib/contract.cdc
index 1bc43e48ea..fa383ee9bd 100644
--- a/fvm/evm/stdlib/contract.cdc
+++ b/fvm/evm/stdlib/contract.cdc
@@ -4,12 +4,8 @@ import "FlowToken"
 access(all)
 contract EVM {
 
-<<<<<<< 33b37f1229 (Merge pull request #5400 from onflow/supun/sync-stable-cadence-master)
      access(all)
-    event BridgedAccountCreated(addressBytes: [UInt8; 20])
-=======
-    pub event CadenceOwnedAccountCreated(addressBytes: [UInt8; 20])
->>>>>>> 6976a4d55a (Merge pull request #5381 from onflow/ramtin/5380-rename-bridge-account)
+     event CadenceOwnedAccountCreated(addressBytes: [UInt8; 20])
 
     /// EVMAddress is an EVM-compatible address
     access(all)
@@ -286,14 +282,8 @@ contract EVM {
         )
         assert(isValid, message: "signatures not valid")
 
-<<<<<<< 33b37f1229 (Merge pull request #5400 from onflow/supun/sync-stable-cadence-master)
-        let coaRef = acc.capabilities.borrow<&EVM.BridgedAccount>(path)
-            ?? panic("could not borrow bridge account's address")
-=======
-        let coaRef = acc.getCapability(path)
-            .borrow<&EVM.CadenceOwnedAccount{EVM.Addressable}>()
-            ?? panic("could not borrow coa resource addressable capability")
->>>>>>> 6976a4d55a (Merge pull request #5381 from onflow/ramtin/5380-rename-bridge-account)
+        let coaRef = acc.capabilities.borrow<&EVM.CadenceOwnedAccount>(path)
+            ?? panic("could not borrow Cadence-owned account's address")
 
         // verify evm address matching
         var i = 0
diff --git a/fvm/evm/stdlib/contract_test.go b/fvm/evm/stdlib/contract_test.go
remerge CONFLICT (content): Merge conflict in fvm/evm/stdlib/contract_test.go
index 5adbbe16f5..9071b155bc 100644
--- a/fvm/evm/stdlib/contract_test.go
+++ b/fvm/evm/stdlib/contract_test.go
@@ -3021,13 +3021,8 @@ func TestCadenceOwnedAccountCall(t *testing.T) {
 
       access(all)
       fun main(): [UInt8] {
-<<<<<<< 33b37f1229 (Merge pull request #5400 from onflow/supun/sync-stable-cadence-master)
-          let bridgedAccount <- EVM.createBridgedAccount()
-		  let bal = EVM.Balance(attoflow: 0)
-=======
           let cadenceOwnedAccount <- EVM.createCadenceOwnedAccount()
-		  let bal = EVM.Balance(0)
->>>>>>> 6976a4d55a (Merge pull request #5381 from onflow/ramtin/5380-rename-bridge-account)
+		  let bal = EVM.Balance(attoflow: 0)
 		  bal.setFLOW(flow: 1.23)
           let response = cadenceOwnedAccount.call(
               to: EVM.EVMAddress(
@@ -3780,26 +3775,17 @@ func TestEVMValidateCOAOwnershipProof(t *testing.T) {
 		import EVM from 0x1
 
 		transaction {
-<<<<<<< 33b37f1229 (Merge pull request #5400 from onflow/supun/sync-stable-cadence-master)
 			prepare(account: auth(Capabilities, SaveValue) &Account) {
-				let bridgedAccount1 <- EVM.createBridgedAccount()
+				let cadenceOwnedAccount <- EVM.createCadenceOwnedAccount()
 
-				account.storage.save<@EVM.BridgedAccount>(
-				    <-bridgedAccount1,
-					to: /storage/bridgedAccount
+				account.storage.save(
+				    <-cadenceOwnedAccount,
+					to: /storage/coa
 				)
 
-				let bridgedAccount = account.capabilities.storage
-				    .issue<&EVM.BridgedAccount>(/storage/bridgedAccount)
-				account.capabilities.publish(bridgedAccount, at: /public/bridgedAccount)
-=======
-			prepare(account: AuthAccount) {
-				let cadenceOwnedAccount1 <- EVM.createCadenceOwnedAccount()
-				account.save<@EVM.CadenceOwnedAccount>(<-cadenceOwnedAccount1,
-					                              to: /storage/coa)
-				account.link<&EVM.CadenceOwnedAccount{EVM.Addressable}>(/public/coa,
-					                                               target: /storage/coa)
->>>>>>> 6976a4d55a (Merge pull request #5381 from onflow/ramtin/5380-rename-bridge-account)
+				let cap = account.capabilities.storage
+				    .issue<&EVM.CadenceOwnedAccount>(/storage/coa)
+				account.capabilities.publish(cap, at: /public/coa)
 			}
 		}`)
 
diff --git a/fvm/evm/types/events.go b/fvm/evm/types/events.go
remerge CONFLICT (content): Merge conflict in fvm/evm/types/events.go
index 686d1bbb60..606fa74312 100644
--- a/fvm/evm/types/events.go
+++ b/fvm/evm/types/events.go
@@ -119,28 +119,16 @@ func (p *TransactionExecutedPayload) CadenceEvent() (cadence.Event, error) {
 			EVMLocation{},
 			string(EventTypeTransactionExecuted),
 			[]cadence.Field{
-<<<<<<< 33b37f1229 (Merge pull request #5400 from onflow/supun/sync-stable-cadence-master)
 				cadence.NewField("blockHeight", cadence.UInt64Type),
 				cadence.NewField("transactionHash", cadence.StringType),
 				cadence.NewField("transaction", cadence.StringType),
 				cadence.NewField("failed", cadence.BoolType),
+				cadence.NewField("vmError", cadence.StringType),
 				cadence.NewField("transactionType", cadence.UInt8Type),
 				cadence.NewField("gasConsumed", cadence.UInt64Type),
 				cadence.NewField("deployedContractAddress", cadence.StringType),
 				cadence.NewField("returnedValue", cadence.StringType),
 				cadence.NewField("logs", cadence.StringType),
-=======
-				cadence.NewField("blockHeight", cadence.UInt64Type{}),
-				cadence.NewField("transactionHash", cadence.StringType{}),
-				cadence.NewField("transaction", cadence.StringType{}),
-				cadence.NewField("failed", cadence.BoolType{}),
-				cadence.NewField("vmError", cadence.StringType{}),
-				cadence.NewField("transactionType", cadence.UInt8Type{}),
-				cadence.NewField("gasConsumed", cadence.UInt64Type{}),
-				cadence.NewField("deployedContractAddress", cadence.StringType{}),
-				cadence.NewField("returnedValue", cadence.StringType{}),
-				cadence.NewField("logs", cadence.StringType{}),
->>>>>>> 6976a4d55a (Merge pull request #5381 from onflow/ramtin/5380-rename-bridge-account)
 			},
 			nil,
 		),
diff --git a/fvm/fvm_test.go b/fvm/fvm_test.go
remerge CONFLICT (content): Merge conflict in fvm/fvm_test.go
index 97a108b49e..9d882a8c5c 100644
--- a/fvm/fvm_test.go
+++ b/fvm/fvm_test.go
@@ -2854,11 +2854,12 @@ func TestEVM(t *testing.T) {
 				import EVM from %s
 				
 				access(all) fun main() {
-					let bal = EVM.Balance(attoflow: 1000000000000000000);
-					let acc <- EVM.createCadenceOwnedAccount();
+					let bal = EVM.Balance(attoflow: 1000000000000000000)
+					let acc <- EVM.createCadenceOwnedAccount()
+
 					// withdraw insufficient balance
-					destroy acc.withdraw(balance: bal);
-					destroy acc;
+					destroy acc.withdraw(balance: bal)
+					destroy acc
 				}
 			`, sc.EVMContract.Address.HexWithPrefix())))
 
@@ -2918,13 +2919,9 @@ func TestEVM(t *testing.T) {
 				script := fvm.Script([]byte(fmt.Sprintf(`
 					import EVM from %s
 					
-<<<<<<< 33b37f1229 (Merge pull request #5400 from onflow/supun/sync-stable-cadence-master)
-					access(all) fun main() {
-						destroy <- EVM.createBridgedAccount();
-=======
-					pub fun main() {
-						destroy <- EVM.createCadenceOwnedAccount();
->>>>>>> 6976a4d55a (Merge pull request #5381 from onflow/ramtin/5380-rename-bridge-account)
+					access(all)
+                    fun main() {
+						destroy <- EVM.createCadenceOwnedAccount()
 					}
 				`, sc.EVMContract.Address.HexWithPrefix())))
 
@@ -3010,7 +3007,7 @@ func TestEVM(t *testing.T) {
 				[]common.TypeID{
 					evmLocation.TypeID(nil, string(types.EventTypeTransactionExecuted)),
 					evmLocation.TypeID(nil, string(types.EventTypeBlockExecuted)),
-					"A.f8d6e0586b0a20c7.EVM.BridgedAccountCreated",
+					"A.f8d6e0586b0a20c7.EVM.CadenceOwnedAccountCreated",
 					"A.0ae53cb6e3f42a79.FlowToken.TokensWithdrawn",
 					"A.ee82856bf20e2aa6.FungibleToken.Withdrawn",
 					evmLocation.TypeID(nil, string(types.EventTypeTransactionExecuted)),

@turbolent
Copy link
Member Author

@onflow/flow-execution-and-verification TestEVMEventsCCFEncodingDecoding/evm.BlockExecuted fails, not sure why. It passes on master

@turbolent turbolent requested a review from a team February 17, 2024 21:58
@codecov-commenter
Copy link

codecov-commenter commented Feb 17, 2024

Codecov Report

Attention: 227 lines in your changes are missing coverage. Please review.

Comparison is base (0c99696) 56.35% compared to head (29d0f15) 56.31%.

Files Patch % Lines
fvm/evm/handler/handler.go 56.92% 82 Missing and 33 partials ⚠️
fvm/evm/handler/codeFinder.go 21.42% 66 Missing ⚠️
fvm/evm/emulator/emulator.go 40.62% 17 Missing and 2 partials ⚠️
fvm/evm/types/errors.go 0.00% 10 Missing ⚠️
fvm/errors/failures.go 0.00% 5 Missing ⚠️
fvm/evm/types/result.go 50.00% 3 Missing and 1 partial ⚠️
fvm/evm/handler/blockstore.go 72.72% 2 Missing and 1 partial ⚠️
fvm/evm/emulator/state/stateDB.go 0.00% 1 Missing and 1 partial ⚠️
fvm/evm/types/call.go 0.00% 2 Missing ⚠️
fvm/evm/types/balance.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@                    Coverage Diff                     @@
##           feature/stable-cadence    #5412      +/-   ##
==========================================================
- Coverage                   56.35%   56.31%   -0.04%     
==========================================================
  Files                        1029     1023       -6     
  Lines                       99604    99105     -499     
==========================================================
- Hits                        56131    55814     -317     
+ Misses                      39256    39069     -187     
- Partials                     4217     4222       +5     
Flag Coverage Δ
unittests 56.31% <49.21%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@turbolent turbolent merged commit bdcaccf into feature/stable-cadence Feb 20, 2024
50 of 51 checks passed
@turbolent turbolent deleted the bastian/update-stable-cadence-10 branch February 20, 2024 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants