Skip to content
This repository has been archived by the owner on Dec 23, 2024. It is now read-only.

Refactor TFHE #79

Merged
merged 3 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions fhevm/contracts_test.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
// Copyright 2014 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

package fhevm

import (
Expand Down
4 changes: 4 additions & 0 deletions fhevm/instructions.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ func verifyIfCiphertextHandle(handle common.Hash, env EVMEnvironment, contractAd
return nil
}

// This function is a modified copy from https://github.com/ethereum/go-ethereum
func OpSload(pc *uint64, env EVMEnvironment, scope ScopeContext) ([]byte, error) {
loc := scope.GetStack().Peek()
hash := common.Hash(loc.Bytes32())
Expand Down Expand Up @@ -265,6 +266,7 @@ func persistIfVerifiedCiphertext(flagHandleLocation common.Hash, handle common.H
}

func OpSstore(pc *uint64, env EVMEnvironment, scope ScopeContext) ([]byte, error) {
// This function is a modified copy from https://github.com/ethereum/go-ethereum
if env.IsReadOnly() {
return nil, ErrWriteProtection
}
Expand Down Expand Up @@ -348,13 +350,15 @@ func RemoveVerifiedCipherextsAtCurrentDepth(env EVMEnvironment) {
}

func OpReturn(pc *uint64, env EVMEnvironment, scope ScopeContext) []byte {
// This function is a modified copy from https://github.com/ethereum/go-ethereum
offset, size := scope.GetStack().Pop(), scope.GetStack().Pop()
ret := scope.GetMemory().GetPtr(int64(offset.Uint64()), int64(size.Uint64()))
delegateCiphertextHandlesToCaller(env, ret)
return ret
}

func OpSelfdestruct(pc *uint64, env EVMEnvironment, scope ScopeContext) (beneficiary uint256.Int, balance *big.Int) {
// This function is a modified copy from https://github.com/ethereum/go-ethereum
beneficiary = scope.GetStack().Pop()
protectedStorage := fhevm_crypto.CreateProtectedStorageContractAddress(scope.GetContract().Address())
balance = env.GetBalance(scope.GetContract().Address())
Expand Down
16 changes: 0 additions & 16 deletions fhevm/instructions_test.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
// Copyright 2014 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

package fhevm

import (
Expand Down
21 changes: 0 additions & 21 deletions fhevm/memory.go
Original file line number Diff line number Diff line change
@@ -1,24 +1,3 @@
// BSD 3-Clause Clear License

// Copyright © 2023 ZAMA.
// All rights reserved.

// Copyright 2015 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

package fhevm

import "github.com/holiman/uint256"
Expand Down
20 changes: 0 additions & 20 deletions fhevm/params.go
Original file line number Diff line number Diff line change
@@ -1,23 +1,3 @@
// BSD 3-Clause Clear License

// Copyright © 2023 ZAMA.
// All rights reserved.

// Copyright 2015 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
package fhevm

// This file contains default gas costs of fhEVM-related operations.
Expand Down
Loading
Loading