Question: There's the following sentence in my Grammar book: 

> 
> It was a lovely surprise to find that all the washing-up **HAD BEEN DONE** while I was asleep.
> 
> 
> 

The only answer mentioned in the answer key is past perfect (in capitals). Since today, I've thought that we use past perfect to clarify the order of actions but if it's clear by itself we don't need one. 

I feel, in this sentence the order of actions is obvious, so **WAS DONE** is also possible. Even more—the past perfect isn't necessary. 

Would someone please explain which tense should be used and why?

Answer: 
"by a month" is simply not idiomatic at all in English here. 

**For time**, one does things or things are done **in a month, week, year, day, hour etc**. That is the period of time that will elapse.

**He beat the deadline by a month**.

There, **by a month is used to measure the number of months he won by.**

Some project has to be handed in in six months. The guy hands the project in in five months. He has beat the deadline ***by a month***.

For time that will elapse (go by) we use in: in a month.

To measure some amount of time in relation to a set time, we use by:

He beat me by ten minutes. They beat us (in the sailing race) by a month.
The primary difference is that one of those two sentences is grammatical, and the other is not.

> 
> "He's sure that he'll speak French fluently **in a month**"
> 
> 
> 

is correct. It is equivalent to "He's sure that he'll speak French fluently within a month", or "He's sure that before a month has passed, he'll speak French fluently". In this context, "[with]in [some amount of time]" means "before [that much time] has elapsed".

> 
> "He's sure that he'll speak French fluently **by a month**"
> 
> 
> 

is not grammatical, because in this context "by [something]" means "before [something] has *happened*". "In" needs a *span* - a *length* of time, which might begin now, or at some other point already established by context ("once he starts the course, he's sure that he'll speak French fluently in a month" would mean the month started when the course did, at some point in the future, rather than right now). 

"**By**" needs an **point** in time: "a month" isn't a point, but "next month" could be (in this context it would be taken to mean "the **start** of next month"). Hence you might say "he's sure that he'll speak French fluently by summer", because "[the start of] summer" is a point. So is "dinner", though expecting someone to gain fluency between now and dinner is probably unreasonable. You can use "by the time [something happens]" in a similar way, so you could say "by the time a month is up", where "the time a month is up" means the point in time at which one complete month has passed.