diff --git a/hardhat/contracts/LilypadEvents.sol b/hardhat/contracts/LilypadEvents.sol index 87ecaa2..fbfcd6d 100644 --- a/hardhat/contracts/LilypadEvents.sol +++ b/hardhat/contracts/LilypadEvents.sol @@ -106,7 +106,7 @@ contract LilypadEvents is Initializable, AccessControlUpgradeable, UUPSUpgradeab LilypadCallerInterface(_to).lilypadFulfilled(address(this), _jobId, _resultType, _result); } - function returnBacalhauError(address _to, uint _jobId, string memory _errorMsg) public onlyRole(UPGRADER_ROLE) { + function returnBacalhauError(address _to, uint _jobId, string memory _errorMsg) public { BacalhauJobResult memory jobResult = BacalhauJobResult({ requestor: _to, id: _jobId, diff --git a/main.go b/main.go index 39ec037..ea95198 100644 --- a/main.go +++ b/main.go @@ -10,11 +10,12 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" "github.com/rs/zerolog" - "github.com/rs/zerolog/log" ) func main() { - ctx := log.Logger.WithContext(context.Background()) + // bacalhaus sets the default logger using buffered writer, so here just create a new one to ensure logs printed. + defaultLog := zerolog.New(os.Stderr).With().Timestamp().Logger() + ctx := defaultLog.WithContext(context.Background()) lvl := zerolog.InfoLevel if level, found := os.LookupEnv("LOG_LEVEL"); found { @@ -36,6 +37,10 @@ func main() { return } + if !common.IsHexAddress(os.Getenv("DEPLOYED_CONTRACT_ADDRESS")) { + fmt.Fprintln(os.Stderr, "DEPLOYED_CONTRACT_ADDRESS: invalid hex address string") + return + } addr := common.HexToAddress(os.Getenv("DEPLOYED_CONTRACT_ADDRESS")) privKey, err := crypto.HexToECDSA(os.Getenv("WALLET_PRIVATE_KEY")) if err != nil {